package com.kscrm.web.service.impl;

import java.util.List;

import com.kscrm.common.utils.SecurityUtils;
import com.kscrm.web.criteria.ProjectCountCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.kscrm.web.mapper.ProjectCollectionMapper;
import com.kscrm.web.domain.ProjectCollection;
import com.kscrm.web.service.IProjectCollectionService;

/**
 * 项目收款Service业务层处理
 * 
 * @author Dhq
 * @date 2025-04-08
 */
@Service
public class ProjectCollectionServiceImpl implements IProjectCollectionService 
{
    @Autowired
    private ProjectCollectionMapper projectCollectionMapper;

    /**
     * 查询项目收款
     * 
     * @param id 项目收款主键
     * @return 项目收款
     */
    @Override
    public ProjectCollection selectProjectCollectionById(Long id)
    {
        return projectCollectionMapper.selectProjectCollectionById(id);
    }

    /**
     * 查询项目收款列表
     * 
     * @param projectCollection 项目收款
     * @return 项目收款
     */
    @Override
    public List<ProjectCollection> selectProjectCollectionList(ProjectCollection projectCollection)
    {
        return projectCollectionMapper.selectProjectCollectionList(projectCollection);
    }

    /**
     * 新增项目收款
     * 
     * @param projectCollection 项目收款
     * @return 结果
     */
    @Override
    public int insertProjectCollection(ProjectCollection projectCollection)
    {
        projectCollection.setChannelId(SecurityUtils.getChannelId());
        return projectCollectionMapper.insertProjectCollection(projectCollection);
    }

    /**
     * 修改项目收款
     * 
     * @param projectCollection 项目收款
     * @return 结果
     */
    @Override
    public int updateProjectCollection(ProjectCollection projectCollection)
    {
        return projectCollectionMapper.updateProjectCollection(projectCollection);
    }

    /**
     * 批量删除项目收款
     * 
     * @param ids 需要删除的项目收款主键
     * @return 结果
     */
    @Override
    public int deleteProjectCollectionByIds(Long[] ids)
    {
        return projectCollectionMapper.deleteProjectCollectionByIds(ids);
    }

    /**
     * 统计项目收款金额
     * @param criteria
     * @return
     */
    @Override
    public int sumProjectMoney(ProjectCountCriteria criteria){
        return projectCollectionMapper.selectSumProjectMoney(criteria);
    }
}
